#include "settings.h"

Settings::Settings(QWidget *parent) : QDialog(parent), settingsWindow(new Ui::Settings)
{
    settingsWindow->setupUi(this);

    readSettingsWindowSettings();

    //The color the user clicked is sent to the function "colorSet_LabelChanges"
    connect(settingsWindow->pickColor_List, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(colorSet_LabelChanges(QListWidgetItem*)));

    //If user clicks "colorDefault_Button" then the function "colorDefault_LabelChanges" sets all labels to clear()
    connect(settingsWindow->colorDefault_Button, SIGNAL(clicked()), this, SLOT(colorDefault_LabelChanges()));

    //When the user adjusts the transparency slider then the function "convertWindowTransparencyIntToString" will adjust the transparency lineEdit
    connect(settingsWindow->windowTransparency_Slider, SIGNAL(valueChanged(int)), this, SLOT(convertWindowTransparencyIntToString(int)));
}

void Settings::readSettingsWindowSettings()
{
    QSettings SettingsWindowSettings("LifeSync", "Project LifeSync");

    //Rewards Settings: New Item Load Settings
    QListWidgetItem *newItem1 = new QListWidgetItem;
    settingsWindow->peopleAnimals_List->insertItem(23, newItem1);
    settingsWindow->peopleAnimals_List->item(23)->setText(SettingsWindowSettings.value("newItemTextOne", "Locked").toString());
    settingsWindow->peopleAnimals_List->item(23)->setIcon(SettingsWindowSettings.value("newItemIconOne").value<QIcon>());
    QListWidgetItem *newItem2 = new QListWidgetItem;
    settingsWindow->peopleAnimals_List->insertItem(24, newItem2);
    settingsWindow->peopleAnimals_List->item(24)->setText(SettingsWindowSettings.value("newItemTextTwo", "Locked").toString());
    settingsWindow->peopleAnimals_List->item(24)->setIcon(SettingsWindowSettings.value("newItemIconTwo").value<QIcon>());
    QListWidgetItem *newItem3 = new QListWidgetItem;
    settingsWindow->holidays_List->insertItem(12, newItem3);
    settingsWindow->holidays_List->item(12)->setText(SettingsWindowSettings.value("newItemTextThree", "Locked").toString());
    settingsWindow->holidays_List->item(12)->setIcon(SettingsWindowSettings.value("newItemIconThree").value<QIcon>());
    QListWidgetItem *newItem4 = new QListWidgetItem;
    settingsWindow->holidays_List->insertItem(13, newItem4);
    settingsWindow->holidays_List->item(13)->setText(SettingsWindowSettings.value("newItemTextFour", "Locked").toString());
    settingsWindow->holidays_List->item(13)->setIcon(SettingsWindowSettings.value("newItemIconFour").value<QIcon>());
    QListWidgetItem *newItem5 = new QListWidgetItem;
    settingsWindow->extra_List->addItem(newItem5);
    newItem5->setText(SettingsWindowSettings.value("newItemTextFive", "Locked").toString());
    newItem5->setIcon(SettingsWindowSettings.value("newItemIconFive").value<QIcon>());
    QListWidgetItem *newItem6 = new QListWidgetItem;
    settingsWindow->extra_List->addItem(newItem6);
    newItem6->setText(SettingsWindowSettings.value("newItemTextSix", "Locked").toString());
    newItem6->setIcon(SettingsWindowSettings.value("newItemIconSix").value<QIcon>());

    //Rewards Statistics Settings: Item Load Settings
    QListWidgetItem *newItem7 = new QListWidgetItem;
    settingsWindow->rewardsUnlocked_List->addItem(newItem7);
    newItem7->setText(SettingsWindowSettings.value("newItemText7", "Locked").toString());
    newItem7->setIcon(SettingsWindowSettings.value("newItemIcon7").value<QIcon>());
    QListWidgetItem *newItem8 = new QListWidgetItem;
    settingsWindow->rewardsUnlocked_List->addItem(newItem8);
    newItem8->setText(SettingsWindowSettings.value("newItemText8", "Locked").toString());
    newItem8->setIcon(SettingsWindowSettings.value("newItemIcon8").value<QIcon>());
    QListWidgetItem *newItem9 = new QListWidgetItem;
    settingsWindow->rewardsUnlocked_List->addItem(newItem9);
    newItem9->setText(SettingsWindowSettings.value("newItemText9", "Locked").toString());
    newItem9->setIcon(SettingsWindowSettings.value("newItemIcon9").value<QIcon>());
    QListWidgetItem *newItem10 = new QListWidgetItem;
    settingsWindow->rewardsUnlocked_List->addItem(newItem10);
    newItem10->setText(SettingsWindowSettings.value("newItemText10", "Locked").toString());
    newItem10->setIcon(SettingsWindowSettings.value("newItemIcon10").value<QIcon>());
    QListWidgetItem *newItem11 = new QListWidgetItem;
    settingsWindow->rewardsUnlocked_List->addItem(newItem11);
    newItem11->setText(SettingsWindowSettings.value("newItemText11", "Locked").toString());
    newItem11->setIcon(SettingsWindowSettings.value("newItemIcon11").value<QIcon>());
    QListWidgetItem *newItem12 = new QListWidgetItem;
    settingsWindow->rewardsUnlocked_List->addItem(newItem12);
    newItem12->setText(SettingsWindowSettings.value("newItemText12", "Locked").toString());
    newItem12->setIcon(SettingsWindowSettings.value("newItemIcon12").value<QIcon>());
    QListWidgetItem *newItem13 = new QListWidgetItem;
    settingsWindow->rewardsUnlocked_List->addItem(newItem13);
    newItem13->setText(SettingsWindowSettings.value("newItemText13", "Locked").toString());
    newItem13->setIcon(SettingsWindowSettings.value("newItemIcon13").value<QIcon>());
    QListWidgetItem *newItem14 = new QListWidgetItem;
    settingsWindow->rewardsUnlocked_List->addItem(newItem14);
    newItem14->setText(SettingsWindowSettings.value("newItemText14", "Locked").toString());
    newItem14->setIcon(SettingsWindowSettings.value("newItemIcon14").value<QIcon>());
    QListWidgetItem *newItem15 = new QListWidgetItem;
    settingsWindow->rewardsUnlocked_List->addItem(newItem15);
    newItem15->setText(SettingsWindowSettings.value("newItemText15", "Locked").toString());
    newItem15->setIcon(SettingsWindowSettings.value("newItemIcon15").value<QIcon>());
    QListWidgetItem *newItem16 = new QListWidgetItem;
    settingsWindow->rewardsUnlocked_List->addItem(newItem16);
    newItem16->setText(SettingsWindowSettings.value("newItemText16", "Locked").toString());
    newItem16->setIcon(SettingsWindowSettings.value("newItemIcon16").value<QIcon>());
    QListWidgetItem *newItem17 = new QListWidgetItem;
    settingsWindow->rewardsUnlocked_List->addItem(newItem17);
    newItem17->setText(SettingsWindowSettings.value("newItemText17", "Locked").toString());
    newItem17->setIcon(SettingsWindowSettings.value("newItemIcon17").value<QIcon>());
}

void Settings::writeSettingsWindowSettings()
{
    QSettings SettingsWindowSettings("LifeSync", "Project LifeSync");

    //Rewards Settings: New Item Save Settings
    if(settingsWindow->peopleAnimals_List->item(23))
    {
    SettingsWindowSettings.setValue("newItemTextOne", settingsWindow->peopleAnimals_List->item(23)->text());
    SettingsWindowSettings.setValue("newItemIconOne", settingsWindow->peopleAnimals_List->item(23)->icon());
    }
    if(settingsWindow->peopleAnimals_List->item(24))
    {
    SettingsWindowSettings.setValue("newItemTextTwo", settingsWindow->peopleAnimals_List->item(24)->text());
    SettingsWindowSettings.setValue("newItemIconTwo", settingsWindow->peopleAnimals_List->item(24)->icon());
    }
    if(settingsWindow->holidays_List->item(12))
    {
    SettingsWindowSettings.setValue("newItemTextThree", settingsWindow->holidays_List->item(12)->text());
    SettingsWindowSettings.setValue("newItemIconThree", settingsWindow->holidays_List->item(12)->icon());
    }
    if(settingsWindow->holidays_List->item(13))
    {
    SettingsWindowSettings.setValue("newItemTextFour", settingsWindow->holidays_List->item(13)->text());
    SettingsWindowSettings.setValue("newItemIconFour", settingsWindow->holidays_List->item(13)->icon());
    }
    if(settingsWindow->extra_List->item(8))
    {
    SettingsWindowSettings.setValue("newItemTextFive", settingsWindow->extra_List->item(8)->text());
    SettingsWindowSettings.setValue("newItemIconFive", settingsWindow->extra_List->item(8)->icon());
    }
    if(settingsWindow->extra_List->item(9))
    {
    SettingsWindowSettings.setValue("newItemTextSix", settingsWindow->extra_List->item(9)->text());
    SettingsWindowSettings.setValue("newItemIconSix", settingsWindow->extra_List->item(9)->icon());
    }

    //Rewards Statistics Settings: Item Load Settings
    if(settingsWindow->rewardsUnlocked_List->item(0))
    {
    SettingsWindowSettings.setValue("newItemText7", settingsWindow->rewardsUnlocked_List->item(0)->text());
    SettingsWindowSettings.setValue("newItemIcon7", settingsWindow->rewardsUnlocked_List->item(0)->icon());
    }
    if(settingsWindow->rewardsUnlocked_List->item(1))
    {
    SettingsWindowSettings.setValue("newItemText8", settingsWindow->rewardsUnlocked_List->item(1)->text());
    SettingsWindowSettings.setValue("newItemIcon8", settingsWindow->rewardsUnlocked_List->item(1)->icon());
    }
    if(settingsWindow->rewardsUnlocked_List->item(2))
    {
    SettingsWindowSettings.setValue("newItemText9", settingsWindow->rewardsUnlocked_List->item(2)->text());
    SettingsWindowSettings.setValue("newItemIcon9", settingsWindow->rewardsUnlocked_List->item(2)->icon());
    }
    if(settingsWindow->rewardsUnlocked_List->item(3))
    {
    SettingsWindowSettings.setValue("newItemText10", settingsWindow->rewardsUnlocked_List->item(3)->text());
    SettingsWindowSettings.setValue("newItemIcon10", settingsWindow->rewardsUnlocked_List->item(3)->icon());
    }
    if(settingsWindow->rewardsUnlocked_List->item(4))
    {
    SettingsWindowSettings.setValue("newItemText11", settingsWindow->rewardsUnlocked_List->item(4)->text());
    SettingsWindowSettings.setValue("newItemIcon11", settingsWindow->rewardsUnlocked_List->item(4)->icon());
    }
    if(settingsWindow->rewardsUnlocked_List->item(5))
    {
    SettingsWindowSettings.setValue("newItemText12", settingsWindow->rewardsUnlocked_List->item(5)->text());
    SettingsWindowSettings.setValue("newItemIcon12", settingsWindow->rewardsUnlocked_List->item(5)->icon());
    }
    if(settingsWindow->rewardsUnlocked_List->item(6))
    {
    SettingsWindowSettings.setValue("newItemText13", settingsWindow->rewardsUnlocked_List->item(6)->text());
    SettingsWindowSettings.setValue("newItemIcon13", settingsWindow->rewardsUnlocked_List->item(6)->icon());
    }
    if(settingsWindow->rewardsUnlocked_List->item(7))
    {
    SettingsWindowSettings.setValue("newItemText14", settingsWindow->rewardsUnlocked_List->item(7)->text());
    SettingsWindowSettings.setValue("newItemIcon14", settingsWindow->rewardsUnlocked_List->item(7)->icon());
    }
    if(settingsWindow->rewardsUnlocked_List->item(8))
    {
    SettingsWindowSettings.setValue("newItemText15", settingsWindow->rewardsUnlocked_List->item(8)->text());
    SettingsWindowSettings.setValue("newItemIcon15", settingsWindow->rewardsUnlocked_List->item(8)->icon());
    }
    if(settingsWindow->rewardsUnlocked_List->item(9))
    {
    SettingsWindowSettings.setValue("newItemText16", settingsWindow->rewardsUnlocked_List->item(9)->text());
    SettingsWindowSettings.setValue("newItemIcon16", settingsWindow->rewardsUnlocked_List->item(9)->icon());
    }
    if(settingsWindow->rewardsUnlocked_List->item(10))
    {
    SettingsWindowSettings.setValue("newItemText17", settingsWindow->rewardsUnlocked_List->item(10)->text());
    SettingsWindowSettings.setValue("newItemIcon17", settingsWindow->rewardsUnlocked_List->item(10)->icon());
    }

    /*
    SettingsWindowSettings.remove("newItemTextOne");
    SettingsWindowSettings.remove("newItemTextTwo");
    SettingsWindowSettings.remove("newItemTextThree");
    SettingsWindowSettings.remove("newItemTextFour");
    SettingsWindowSettings.remove("newItemTextFive");
    SettingsWindowSettings.remove("newItemTextSix");
    SettingsWindowSettings.remove("newItemIconOne");
    SettingsWindowSettings.remove("newItemIconTwo");
    SettingsWindowSettings.remove("newItemIconThree");
    SettingsWindowSettings.remove("newItemIconFour");
    SettingsWindowSettings.remove("newItemIconFive");
    SettingsWindowSettings.remove("newItemIconSix");
    SettingsWindowSettings.remove("newItemIcon7");
    SettingsWindowSettings.remove("newItemText7");
    SettingsWindowSettings.remove("newItemIcon8");
    SettingsWindowSettings.remove("newItemText8");
    SettingsWindowSettings.remove("newItemIcon9");
    SettingsWindowSettings.remove("newItemText9");
    SettingsWindowSettings.remove("newItemIcon10");
    SettingsWindowSettings.remove("newItemText10");
    SettingsWindowSettings.remove("newItemIcon11");
    SettingsWindowSettings.remove("newItemText11");
    SettingsWindowSettings.remove("newItemIcon12");
    SettingsWindowSettings.remove("newItemText12");
    SettingsWindowSettings.remove("newItemIcon13");
    SettingsWindowSettings.remove("newItemText13");
    SettingsWindowSettings.remove("newItemIcon14");
    SettingsWindowSettings.remove("newItemText14");
    SettingsWindowSettings.remove("newItemIcon15");
    SettingsWindowSettings.remove("newItemText15");
    SettingsWindowSettings.remove("newItemIcon16");
    SettingsWindowSettings.remove("newItemText16");
    SettingsWindowSettings.remove("newItemIcon17");
    SettingsWindowSettings.remove("newItemText17");
    */
}

void Settings::convertWindowTransparencyIntToString(int transparencyInt)
{
    QString transparencyConvertedString;
    transparencyConvertedString.setNum(transparencyInt);
    settingsWindow->windowTransparency_LineEdit->setText(transparencyConvertedString);
}

void Settings::callColor_LabelChanges()
{
    connect(settingsWindow->allColor_Button, SIGNAL(clicked()), this, SLOT(allColor_LabelChanges()));
    connect(settingsWindow->settingsColor_Button, SIGNAL(clicked()), this, SLOT(settingsColor_LabelChanges()));
    connect(settingsWindow->infoColor_Button, SIGNAL(clicked()), this, SLOT(informationColor_LabelChanges()));
    connect(settingsWindow->contactsColor_Button, SIGNAL(clicked()), this, SLOT(contactsColor_LabelChanges()));
    connect(settingsWindow->mainColor_Button, SIGNAL(clicked()), this, SLOT(mainColor_LabelChanges()));
    connect(settingsWindow->calenderColor_Button, SIGNAL(clicked()), this, SLOT(calendarColor_LabelChanges()));
    connect(settingsWindow->checklistColor_Button, SIGNAL(clicked()), this, SLOT(checklistColor_LabelChanges()));
    connect(settingsWindow->calculatorColor_Button, SIGNAL(clicked()), this, SLOT(calculatorColor_LabelChanges()));
    connect(settingsWindow->favoritesColor_Button, SIGNAL(clicked()), this, SLOT(favoritesColor_LabelChanges()));
}

/*
    Once the user has clicked a color this function will determine where to branch to change the appropriate labels

    Example: If the user selects color "Red" and clicks the "Info" button then the function "informationColor_LabelChanges" is called
*/
void Settings::colorSet_LabelChanges(QListWidgetItem* color)
{
    if(color->text() == "Red")
    {
        labelColorCheck = 1;
        callColor_LabelChanges();
    }
    else if(color->text() == "Orange")
    {
        labelColorCheck = 2;
        callColor_LabelChanges();
    }
    else if(color->text() == "Yellow")
    {
        labelColorCheck = 3;
        callColor_LabelChanges();
    }
    else if(color->text() == "Green")
    {
        labelColorCheck = 4;
        callColor_LabelChanges();
    }
    else if(color->text() == "Teal")
    {
        labelColorCheck = 5;
        callColor_LabelChanges();
    }
    else if(color->text() == "Blue")
    {
        labelColorCheck = 6;
        callColor_LabelChanges();
    }
    else if(color->text() == "Pink")
    {
        labelColorCheck = 7;
        callColor_LabelChanges();
    }
    else if(color->text() == "Purple")
    {
        labelColorCheck = 8;
        callColor_LabelChanges();
    }
    else if(color->text() == "Magenta")
    {
        labelColorCheck = 9;
        callColor_LabelChanges();
    }
    else if(color->text() == "Voilet")
    {
        labelColorCheck = 10;
        callColor_LabelChanges();
    }
}

void Settings::changeColor_Labels(QString labelColor)
{
    settingsWindow->allColor_Label->setStyleSheet(QString("QLabel{background: " + labelColor + "}"));
    settingsWindow->mainColor_Label->setStyleSheet(QString("QLabel{background: " + labelColor + "}"));
    settingsWindow->calendarColor_Label->setStyleSheet(QString("QLabel{background: " + labelColor + "}"));
    settingsWindow->checklistColor_Label->setStyleSheet(QString("QLabel{background: " + labelColor + "}"));
    settingsWindow->calculatorColor_Label->setStyleSheet(QString("QLabel{background: " + labelColor + "}"));
    settingsWindow->contactsColor_Label->setStyleSheet(QString("QLabel{background: " + labelColor + "}"));
    settingsWindow->settingsColor_Label->setStyleSheet(QString("QLabel{background: " + labelColor + "}"));
    settingsWindow->infoColor_Label->setStyleSheet(QString("QLabel{background: " + labelColor + "}"));
    settingsWindow->favoritesColor_Label->setStyleSheet(QString("QLabel{background: " + labelColor + "}"));
}

/*
    The functions below will apply the appropriate image to the correct label based upon user input or clear image if default

    Applies to: void allColor_LabelChanges();
                void informationColor_LabelChanges();
                void mainColor_LabelChanges();
                void colorDefault_LabelChanges();
                void settingsColor_LabelChanges();
                void contactsColor_LabelChanges();
                void calendarColor_LabelChanges();
                void checklistColor_LabelChanges();
                void calculatorColor_LabelChanges();
                void favoritesColor_LabelChanges();
*/
void Settings::allColor_LabelChanges()
{
    if(labelColorCheck == 1)
    {
        labelColor = "red";
        changeColor_Labels(labelColor);
    }
    if(labelColorCheck == 2)
    {
        labelColor = "orange";
        changeColor_Labels(labelColor);
    }
    if(labelColorCheck == 3)
    {
        labelColor = "yellow";
        changeColor_Labels(labelColor);
    }
    if(labelColorCheck == 4)
    {
        labelColor = "green";
        changeColor_Labels(labelColor);
    }
    if(labelColorCheck == 5)
    {
        labelColor = "rgb(0, 255, 255)";
        changeColor_Labels(labelColor);
    }
    if(labelColorCheck == 6)
    {
        labelColor = "blue";
        changeColor_Labels(labelColor);
    }
    if(labelColorCheck == 7)
    {
        labelColor = "rgb(255, 0, 255)";
        changeColor_Labels(labelColor);
    }
    if(labelColorCheck == 8)
    {
        labelColor = "rgb(170, 0, 255)";
        changeColor_Labels(labelColor);
    }
    if(labelColorCheck == 9)
    {
        labelColor = "rgb(255, 0, 127)";
        changeColor_Labels(labelColor);
    }
    if(labelColorCheck == 10)
    {
        labelColor = "rgb(85, 0, 127)";
        changeColor_Labels(labelColor);
    }
}

void Settings::settingsColor_LabelChanges()
{
    if(labelColorCheck == 1)
        settingsWindow->settingsColor_Label->setStyleSheet(QString("QLabel{background: red }"));
    if(labelColorCheck == 2)
        settingsWindow->settingsColor_Label->setStyleSheet(QString("QLabel{background: orange }"));
    if(labelColorCheck == 3)
        settingsWindow->settingsColor_Label->setStyleSheet(QString("QLabel{background: yellow }"));
    if(labelColorCheck == 4)
        settingsWindow->settingsColor_Label->setStyleSheet(QString("QLabel{background: green }"));
    if(labelColorCheck == 5)
        settingsWindow->settingsColor_Label->setStyleSheet(QString("QLabel{background: rgb(0, 255, 255) }"));
    if(labelColorCheck == 6)
        settingsWindow->settingsColor_Label->setStyleSheet(QString("QLabel{background: blue }"));
    if(labelColorCheck == 7)
        settingsWindow->settingsColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 255) }"));
    if(labelColorCheck == 8)
        settingsWindow->settingsColor_Label->setStyleSheet(QString("QLabel{background: rgb(170, 0, 255) }"));
    if(labelColorCheck == 9)
        settingsWindow->settingsColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 127) }"));
    if(labelColorCheck == 10)
        settingsWindow->settingsColor_Label->setStyleSheet(QString("QLabel{background: rgb(85, 0, 127) }"));
}

void Settings::informationColor_LabelChanges()
{
    if(labelColorCheck == 1)
        settingsWindow->infoColor_Label->setStyleSheet(QString("QLabel{background: red }"));
    if(labelColorCheck == 2)
        settingsWindow->infoColor_Label->setStyleSheet(QString("QLabel{background: orange }"));
    if(labelColorCheck == 3)
        settingsWindow->infoColor_Label->setStyleSheet(QString("QLabel{background: yellow }"));
    if(labelColorCheck == 4)
        settingsWindow->infoColor_Label->setStyleSheet(QString("QLabel{background: green }"));
    if(labelColorCheck == 5)
        settingsWindow->infoColor_Label->setStyleSheet(QString("QLabel{background: rgb(0, 255, 255) }"));
    if(labelColorCheck == 6)
        settingsWindow->infoColor_Label->setStyleSheet(QString("QLabel{background: blue }"));
    if(labelColorCheck == 7)
        settingsWindow->infoColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 255) }"));
    if(labelColorCheck == 8)
        settingsWindow->infoColor_Label->setStyleSheet(QString("QLabel{background: rgb(170, 0, 255) }"));
    if(labelColorCheck == 9)
        settingsWindow->infoColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 127) }"));
    if(labelColorCheck == 10)
        settingsWindow->infoColor_Label->setStyleSheet(QString("QLabel{background: rgb(85, 0, 127) }"));
}

void Settings::contactsColor_LabelChanges()
{
    if(labelColorCheck == 1)
        settingsWindow->contactsColor_Label->setStyleSheet(QString("QLabel{background: red }"));
    if(labelColorCheck == 2)
        settingsWindow->contactsColor_Label->setStyleSheet(QString("QLabel{background: orange }"));
    if(labelColorCheck == 3)
        settingsWindow->contactsColor_Label->setStyleSheet(QString("QLabel{background: yellow }"));
    if(labelColorCheck == 4)
        settingsWindow->contactsColor_Label->setStyleSheet(QString("QLabel{background: green }"));
    if(labelColorCheck == 5)
        settingsWindow->contactsColor_Label->setStyleSheet(QString("QLabel{background: rgb(0, 255, 255) }"));
    if(labelColorCheck == 6)
        settingsWindow->contactsColor_Label->setStyleSheet(QString("QLabel{background: blue }"));
    if(labelColorCheck == 7)
        settingsWindow->contactsColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 255) }"));
    if(labelColorCheck == 8)
        settingsWindow->contactsColor_Label->setStyleSheet(QString("QLabel{background: rgb(170, 0, 255) }"));
    if(labelColorCheck == 9)
        settingsWindow->contactsColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 127) }"));
    if(labelColorCheck == 10)
        settingsWindow->contactsColor_Label->setStyleSheet(QString("QLabel{background: rgb(85, 0, 127) }"));
}

void Settings::mainColor_LabelChanges()
{
    if(labelColorCheck == 1)
        settingsWindow->mainColor_Label->setStyleSheet(QString("QLabel{background: red }"));
    if(labelColorCheck == 2)
        settingsWindow->mainColor_Label->setStyleSheet(QString("QLabel{background: orange }"));
    if(labelColorCheck == 3)
        settingsWindow->mainColor_Label->setStyleSheet(QString("QLabel{background: yellow }"));
    if(labelColorCheck == 4)
        settingsWindow->mainColor_Label->setStyleSheet(QString("QLabel{background: green }"));
    if(labelColorCheck == 5)
        settingsWindow->mainColor_Label->setStyleSheet(QString("QLabel{background: rgb(0, 255, 255) }"));
    if(labelColorCheck == 6)
        settingsWindow->mainColor_Label->setStyleSheet(QString("QLabel{background: blue }"));
    if(labelColorCheck == 7)
        settingsWindow->mainColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 255) }"));
    if(labelColorCheck == 8)
        settingsWindow->mainColor_Label->setStyleSheet(QString("QLabel{background: rgb(170, 0, 255) }"));
    if(labelColorCheck == 9)
        settingsWindow->mainColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 127) }"));
    if(labelColorCheck == 10)
        settingsWindow->mainColor_Label->setStyleSheet(QString("QLabel{background: rgb(85, 0, 127) }"));
}

void Settings::calendarColor_LabelChanges()
{
    if(labelColorCheck == 1)
        settingsWindow->calendarColor_Label->setStyleSheet(QString("QLabel{background: red }"));
    if(labelColorCheck == 2)
        settingsWindow->calendarColor_Label->setStyleSheet(QString("QLabel{background: orange }"));
    if(labelColorCheck == 3)
        settingsWindow->calendarColor_Label->setStyleSheet(QString("QLabel{background: yellow }"));
    if(labelColorCheck == 4)
        settingsWindow->calendarColor_Label->setStyleSheet(QString("QLabel{background: green }"));
    if(labelColorCheck == 5)
        settingsWindow->calendarColor_Label->setStyleSheet(QString("QLabel{background: rgb(0, 255, 255) }"));
    if(labelColorCheck == 6)
        settingsWindow->calendarColor_Label->setStyleSheet(QString("QLabel{background: blue }"));
    if(labelColorCheck == 7)
        settingsWindow->calendarColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 255) }"));
    if(labelColorCheck == 8)
        settingsWindow->calendarColor_Label->setStyleSheet(QString("QLabel{background: rgb(170, 0, 255) }"));
    if(labelColorCheck == 9)
        settingsWindow->calendarColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 127) }"));
    if(labelColorCheck == 10)
        settingsWindow->calendarColor_Label->setStyleSheet(QString("QLabel{background: rgb(85, 0, 127) }"));
}

void Settings::checklistColor_LabelChanges()
{
    if(labelColorCheck == 1)
        settingsWindow->checklistColor_Label->setStyleSheet(QString("QLabel{background: red }"));
    if(labelColorCheck == 2)
        settingsWindow->checklistColor_Label->setStyleSheet(QString("QLabel{background: orange }"));
    if(labelColorCheck == 3)
        settingsWindow->checklistColor_Label->setStyleSheet(QString("QLabel{background: yellow }"));
    if(labelColorCheck == 4)
        settingsWindow->checklistColor_Label->setStyleSheet(QString("QLabel{background: green }"));
    if(labelColorCheck == 5)
        settingsWindow->checklistColor_Label->setStyleSheet(QString("QLabel{background: rgb(0, 255, 255) }"));
    if(labelColorCheck == 6)
        settingsWindow->checklistColor_Label->setStyleSheet(QString("QLabel{background: blue }"));
    if(labelColorCheck == 7)
        settingsWindow->checklistColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 255) }"));
    if(labelColorCheck == 8)
        settingsWindow->checklistColor_Label->setStyleSheet(QString("QLabel{background: rgb(170, 0, 255) }"));
    if(labelColorCheck == 9)
        settingsWindow->checklistColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 127) }"));
    if(labelColorCheck == 10)
        settingsWindow->checklistColor_Label->setStyleSheet(QString("QLabel{background: rgb(85, 0, 127) }"));
}

void Settings::calculatorColor_LabelChanges()
{
    if(labelColorCheck == 1)
        settingsWindow->calculatorColor_Label->setStyleSheet(QString("QLabel{background: red }"));
    if(labelColorCheck == 2)
        settingsWindow->calculatorColor_Label->setStyleSheet(QString("QLabel{background: orange }"));
    if(labelColorCheck == 3)
        settingsWindow->calculatorColor_Label->setStyleSheet(QString("QLabel{background: yellow }"));
    if(labelColorCheck == 4)
        settingsWindow->calculatorColor_Label->setStyleSheet(QString("QLabel{background: green }"));
    if(labelColorCheck == 5)
        settingsWindow->calculatorColor_Label->setStyleSheet(QString("QLabel{background: rgb(0, 255, 255) }"));
    if(labelColorCheck == 6)
        settingsWindow->calculatorColor_Label->setStyleSheet(QString("QLabel{background: blue }"));
    if(labelColorCheck == 7)
        settingsWindow->calculatorColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 255) }"));
    if(labelColorCheck == 8)
        settingsWindow->calculatorColor_Label->setStyleSheet(QString("QLabel{background: rgb(170, 0, 255) }"));
    if(labelColorCheck == 9)
        settingsWindow->calculatorColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 127) }"));
    if(labelColorCheck == 10)
        settingsWindow->calculatorColor_Label->setStyleSheet(QString("QLabel{background: rgb(85, 0, 127) }"));
}

void Settings::favoritesColor_LabelChanges()
{
    if(labelColorCheck == 1)
        settingsWindow->favoritesColor_Label->setStyleSheet(QString("QLabel{background: red }"));
    if(labelColorCheck == 2)
        settingsWindow->favoritesColor_Label->setStyleSheet(QString("QLabel{background: orange }"));
    if(labelColorCheck == 3)
        settingsWindow->favoritesColor_Label->setStyleSheet(QString("QLabel{background: yellow }"));
    if(labelColorCheck == 4)
        settingsWindow->favoritesColor_Label->setStyleSheet(QString("QLabel{background: green }"));
    if(labelColorCheck == 5)
        settingsWindow->favoritesColor_Label->setStyleSheet(QString("QLabel{background: rgb(0, 255, 255) }"));
    if(labelColorCheck == 6)
        settingsWindow->favoritesColor_Label->setStyleSheet(QString("QLabel{background: blue }"));
    if(labelColorCheck == 7)
        settingsWindow->favoritesColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 255) }"));
    if(labelColorCheck == 8)
        settingsWindow->favoritesColor_Label->setStyleSheet(QString("QLabel{background: rgb(170, 0, 255) }"));
    if(labelColorCheck == 9)
        settingsWindow->favoritesColor_Label->setStyleSheet(QString("QLabel{background: rgb(255, 0, 127) }"));
    if(labelColorCheck == 10)
        settingsWindow->favoritesColor_Label->setStyleSheet(QString("QLabel{background: rgb(85, 0, 127) }"));
}

void Settings::colorDefault_LabelChanges()
{
    labelColor = "none";
    changeColor_Labels(labelColor);
}

//Rewards
void Settings::addListItem(QString avatarReward)
{    
    if(avatarReward == "Gamer")
    {
        settingsWindow->peopleAnimals_List->item(23)->setIcon(QIcon("../images/avatars/gamer.png"));
        settingsWindow->peopleAnimals_List->item(23)->setText(avatarReward);

        settingsWindow->rewardsUnlocked_List->item(3)->setIcon(QIcon("../images/avatars/gamer.png"));
        settingsWindow->rewardsUnlocked_List->item(3)->setText("Gamer avatar");
    }
    else if(avatarReward == "Rhino Xing")
    {
        settingsWindow->peopleAnimals_List->item(24)->setIcon(QIcon("../images/avatars/warning_rhinoceros.png"));
        settingsWindow->peopleAnimals_List->item(24)->setText(avatarReward);

        settingsWindow->rewardsUnlocked_List->item(9)->setIcon(QIcon("../images/avatars/warning_rhinoceros.png"));
        settingsWindow->rewardsUnlocked_List->item(9)->setText("Rhino Xing avatar");
    }
    else if(avatarReward == "Candy Cane")
    {
        settingsWindow->holidays_List->item(12)->setIcon(QIcon("../images/holiday/christmas_cane.png"));
        settingsWindow->holidays_List->item(12)->setText(avatarReward);

        settingsWindow->rewardsUnlocked_List->item(1)->setIcon(QIcon("../images/holiday/christmas_cane.png"));
        settingsWindow->rewardsUnlocked_List->item(1)->setText("Canndy Cane avatar");
    }
    else if(avatarReward == "Christmas Tree")
    {
        settingsWindow->holidays_List->item(13)->setIcon(QIcon("../images/holiday/christmas_tree.png"));
        settingsWindow->holidays_List->item(13)->setText(avatarReward);

        settingsWindow->rewardsUnlocked_List->item(5)->setIcon(QIcon("../images/holiday/christmas_tree.png"));
        settingsWindow->rewardsUnlocked_List->item(5)->setText("Christmas Tree avatar");
    }   
    else if(avatarReward == "Linux")
    {
        settingsWindow->extra_List->item(8)->setIcon(QIcon("../images/extra/linux.png"));
        settingsWindow->extra_List->item(8)->setText(avatarReward);

        settingsWindow->rewardsUnlocked_List->item(7)->setIcon(QIcon("../images/extra/linux.png"));
        settingsWindow->rewardsUnlocked_List->item(7)->setText("Linux avatar");
    }
    else if(avatarReward == "LifeSync")
    {
        settingsWindow->extra_List->item(9)->setIcon(QIcon("../images/lifesync_images_icons/lifesync_avatar.png"));
        settingsWindow->extra_List->item(9)->setText(avatarReward);

        settingsWindow->rewardsUnlocked_List->item(0)->setIcon(QIcon("../images/lifesync_images_icons/lifesync_avatar.png"));
        settingsWindow->rewardsUnlocked_List->item(0)->setText("LifeSync avatar");
    }
}

//Theme Help audio clip
void Settings::on_themeHelp_Button_clicked()
{
    QSound::play( "../sounds/themehelp.wav" );
}

//Avatar Help audio clip
void Settings::on_avatarHelp_Button_clicked()
{
    QSound::play( "../sounds/avatarhelp.wav" );
}

Settings::~Settings()
{
    delete settingsWindow;
}

void Settings::on_close_Button_clicked()
{
    Settings::close();
}
